build(proto): use prebuilt protoc toolchain instead of compiling from source#165
Merged
Conversation
behinddwalls
approved these changes
May 29, 2026
bddbe79 to
05c63ce
Compare
a6edf89 to
3378fc8
Compare
3378fc8 to
135a8bb
Compare
… source Registers toolchains_protoc and enables proto toolchain resolution so the proto rules resolve a downloaded protoc binary instead of building @protobuf//:protoc (and its abseil/upb C++ deps) from source on every cold build. Why the noise existed (and why it's gone): the proto rules compiled protoc + abseil from source using the host's Clang, which is newer than the pinned abseil and flagged a deprecated builtin ~800x as build-action stderr; with a prebuilt protoc binary no C++ is compiled, so those warnings are never produced. Cold `make test` (after `bazel clean`): | Metric | Before | After | |-------------------------------------|---------|-------| | make test output | 30,868 | 69 | | abseil deprecation warnings | 802 | 0 | | protobuf/abseil `[for tool]` compiles | ~250+ | 0 | | `external/` lines | 9,741 | 1 | | tests passing | 35 | 35 | | cold wall time | ~84s | ~11s | Changes: - MODULE.bazel: add toolchains_protoc (listed first to win toolchain resolution over the transitive protobuf module) and register its toolchain - .bazelrc: --incompatible_enable_proto_toolchain_resolution No generated *.pb.go changes; rules_go needs no BUILD changes. Validated with bazel clean + make test (35/35 pass), bazel build //..., bazel mod tidy, gazelle. Co-authored-by: Cursor <cursoragent@cursor.com>
135a8bb to
21a814f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Updates bazel such that the proto rules resolve a downloaded protoc binary instead of building
@protobuf//:protoc(and itsabseil/upbC++ deps) from source on every cold build.Before this code change, 30k lines of noise was being dumped to terminal on
make test, because the proto rules were compiling protoc and abseil from source which caused issues depending on hostclangversion (mine was newer than that was required which led to hundreds of deprecation warnings).After this code change, we no longer build protoc and abseil from source and no longer see deprecation warnings. It's also faster since we don't need to build protoc from scratch.
Cold
make test(afterbazel clean):[for tool]compilesexternal/linesTest Plan
✅
make test && make fmt && make lint✅
bazel clean && make testproduces clean output without compile warningsIssues
Stack